{% from 'macros.html' import inline_field, block_field %} {% set filtering = form_type
== "pool_filtering" %}
<div class="modal-body">
  <form
    id="{{ form_type }}-form"
    class="form-horizontal form-label-left add-id"
    method="post"
    autocomplete="off"
  >
    <ul class="nav nav-tabs bar_tabs">
      <li class="nav-item active">
        <a class="nav-link href-id" data-toggle="tab" href="#common-properties"
          >Properties</a
        >
      </li>
      <li class="nav-item">
        <a class="nav-link href-id" data-toggle="tab" href="#device-properties"
          >Device Properties</a
        >
      </li>
      <li class="nav-item">
        <a class="nav-link href-id" data-toggle="tab" href="#link-properties"
          >Link Properties</a
        >
      </li>
      <li class="nav-item">
        <a class="nav-link href-id" data-toggle="tab" href="#custom-properties"
          >Custom Properties</a
        >
      </li>
      <li class="nav-item add-id" id="rbac-nav">
        <a class="nav-link href-id" data-toggle="tab" href="#rbac-properties"
          >Access Control</a
        >
      </li>
    </ul>
    <div class="tab-content">
      <div class="tab-pane fade in active add-id" id="common-properties">
        {{ form.id(id='pool-id', class="add-id") }} {{ form.hidden_tag() }}
        <div class="form-group">
          {% for field_name in ("name", "creator", "description", "admin_only",
          "manually_defined") %} {{ block_field(form, field_name) }} {% endfor %}
        </div>
      </div>
      {% for model in form.models %}
      <div class="tab-pane fade add-id" id="{{ model }}-properties">
        <table
          class="table table-striped table-bordered dt-responsive nowrap"
          cellspacing="0"
          width="100%"
        >
          {% if not filtering %}
          <thead>
            <tr>
              <th>Property</th>
              <th>Value</th>

              <th style="width: 25%;">Match</th>
              <th style="width: 5%;">Invert</th>
            </tr>
          </thead>
          {% endif %}
          <tbody>
            {% for property in form[model + "_properties"] %} {% set property_name =
            "{}_{}".format(model, property) %} {% if filtering %} {{ block_field(form,
            property_name) }} {% else %}
            <tr>
              <td>
                {{ names.get(property, property.replace("_", " ").capitalize() ) }}
              </td>
              <td>
                {{ form[property_name](id="pool-" + property_name, class="form-control
                add-id") }}
              </td>
              <td>
                {{ form[property_name + '_match'](id="pool-" + property_name + '_match',
                class="form-control add-id no-search") }}
              </td>
              <td>
                <center>
                  {{ form[property_name + '_invert'](id="pool-" + property_name +
                  '_invert', class="form-control add-id", style="width: 30px; height:
                  25px") }}
                </center>
              </td>
            </tr>
            {% endif %} {% endfor %}
          </tbody>
        </table>
      </div>
      {% endfor %}
      <div class="tab-pane fade add-id" id="custom-properties">
        {% for property, values in form.custom_properties.items() %} {{
        block_field(form, property) }} {% endfor %}
      </div>
      <div class="tab-pane fade add-id" id="rbac-properties">
        {{ block_field(form, "owners") }} {% for property in form.rbac_properties %} {{
        block_field(form, property) }} {% endfor %}
      </div>
    </div>
  </form>
</div>
